<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>法律列表</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <link rel="stylesheet" href="../css/font.css">
        <link rel="stylesheet" href="../css/xadmin.css">
        <script type="text/javascript" src="../assets/js/jquery-1.8.3.min.js"></script>
        <script src="../lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="../js/xadmin.js"></script>
    </head>
    <body>
        <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">演示</a>
            <a>
              <cite>导航元素</cite></a>
          </span>
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <div class="layui-form layui-col-space5">
                                <div class="layui-inline layui-show-xs-block">
                                <div class="layui-inline layui-show-xs-block">
                                    <input type="text" name="username"  id="name" placeholder="请输入作者" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn"  lay-submit="" id="butt" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                                </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-card-header">
                            <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
                       
                        </div>
                        <div class="layui-card-body ">
                            <table class="layui-hide" id="test" lay-filter="test"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div> 
    </body>
</html>
<script>
    layui.use(['table', 'jquery'], function () {
        var table = layui.table;
        var $ = layui.jquery;
        $.ajax({
            type:"GET",
            url:"http://localhost:8080/api/flxc",
            data:{"title":null},
            headers:{
                token:localStorage.getItem("token")
            },
            datatype: "json",
            success:function (data){
                table.render({
                    elem: '#test'
                    ,data:data.data
                    ,toolbar: '#toolbarDemo'
                    ,title: '社区公告'
                    ,page:{
                        limits:[10,15,20,25],
                        limit:10
                    }
                    ,cols: [[
                        ,{field:'lid', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
                        ,{field:'ltitle', width:120, title: '标题'}
                        ,{field:'lauthor', title:'作者', width:170, edit: 'text'}
                        ,{field:'linfo', title:'详情信息', width:60, edit: 'text', sort: true,width:200}
                        ,{field:'lcreateTime', title:'发布时间', width:190, sort: true}
                    ]]
                });
            }
        })
        $("#butt").click(function (){
            let name=$("#name").val();
            $.ajax({
                type:"GET",
                url:"http://localhost:8080/api/cxflxc",
                data:{"name":name},
                headers:{
                    token:localStorage.getItem("token")
                },
                datatype: "json",
                success:function (data){
                    table.render({
                        elem: '#test'
                        ,data:data.data
                        ,toolbar: '#toolbarDemo'
                        ,title: '社区公告'
                        ,page:{
                            limits:[10,15,20,25],
                            limit:10
                        }
                        ,cols: [[
                            ,{field:'lid', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
                            ,{field:'ltitle', width:120, title: '标题'}
                            ,{field:'lauthor', title:'作者', width:170, edit: 'text'}
                            ,{field:'linfo', title:'详情信息', width:60, edit: 'text', sort: true,width:200}
                            ,{field:'lcreateTime', title:'发布时间', width:190, sort: true}
                        ]]
                    });
                }
            })
        })
    })

</script>
